package com.pengtu.entity.app;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.pengtu.entity.IdEntity;
import com.pengtu.entity.app.User;

/**
 * 部门.
 * 
 * 注释见{@link User}.
 * 
 * @author calvin
 */
@Entity
@Table(name = "T_APP_DEPARTMENT")
@JsonAutoDetect 
@JsonIgnoreProperties (value = { "organization"}) 
public class Department extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String depCode; // 部门编码
	private String depName; // 部门名称
	private String depAllName; // 部门全称
	private String burderMan; // 主要负责人
	private String contactMan; // 联系人
	private String depType; // 机构类别
	private String contactTelephone; // 联系电话
	private String portraiture; // 传真
	private String functionDesc; // 职能描述
	private int staffers; // 职员人数
	private String remark; // 备注
	private Organization organization; // 所属单位信息
	private String fid;

	@Column(nullable = false, length = 15, unique = true, name = "DEPCODE")
	public String getDepCode() {
		return depCode;
	}

	public void setDepCode(String depCode) {
		this.depCode = depCode;
	}

	@Column(nullable = false, length = 30, name = "DEPNAME")
	public String getDepName() {
		return depName;
	}

	public void setDepName(String depName) {
		this.depName = depName;
	}

	@Column(name = "DEPALLNAME")
	public String getDepAllName() {
		return depAllName;
	}

	public void setDepAllName(String depAllName) {
		this.depAllName = depAllName;
	}

	@Column(name = "BURDERMAN")
	public String getBurderMan() {
		return burderMan;
	}

	public void setBurderMan(String burderMan) {
		this.burderMan = burderMan;
	}

	@Column(name = "CONTACTMAN")
	public String getContactMan() {
		return contactMan;
	}

	public void setContactMan(String contactMan) {
		this.contactMan = contactMan;
	}

	@Column(name = "DEPTYPE")
	public String getDepType() {
		return depType;
	}

	public void setDepType(String depType) {
		this.depType = depType;
	}

	@Column(name = "CONTACTTELEPHONE")
	public String getContactTelephone() {
		return contactTelephone;
	}

	public void setContactTelephone(String contactTelephone) {
		this.contactTelephone = contactTelephone;
	}

	public String getPortraiture() {
		return portraiture;
	}

	public void setPortraiture(String portraiture) {
		this.portraiture = portraiture;
	}

	@Column(name = "FUNCTIONDESC")
	public String getFunctionDesc() {
		return functionDesc;
	}

	public void setFunctionDesc(String functionDesc) {
		this.functionDesc = functionDesc;
	}

	@Column(name = "STAFFERS")
	public int getStaffers() {
		return staffers;
	}

	public void setStaffers(int staffers) {
		this.staffers = staffers;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@ManyToOne(targetEntity = Organization.class, cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
	@NotFound(action = NotFoundAction.IGNORE)
	@JoinColumn(name = "ORGID", insertable = true, updatable = true)
	public Organization getOrganization() {
		return organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}
	
	@Column(name="FID")
	public String getFid(){
		return fid;
	}

	public void setFid(String fid) {
		this.fid = fid;
	}

}
